package cn.dmp.tools

import org.apache.spark.sql.SQLContext
import org.apache.spark.{SparkConf, SparkContext}

object SQL4Parquet {

    def main(args: Array[String]): Unit = {

        val sparkConf = new SparkConf()
          .setMaster("local[*]")
          .setAppName("读取parquet文件内容")

        val sc = new SparkContext(sparkConf)
        val sQLContext = new SQLContext(sc)


        val dataFrame = sQLContext.read.parquet("F:\\Temp\\parquet")
        dataFrame.registerTempTable("logs")
        sQLContext.sql("select * from logs").show()

        sc.stop()
    }

}
